home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / handson / supercede / Knowodys / Projects / Palette2 / rgb / Form1.java.bak next >
Encoding:
Text File  |  1998-01-19  |  3.2 KB  |  134 lines

  1. /**
  2.  * 
  3.  * You can add code anywhere in this file - except in the areas that are
  4.  * written by the editor. You should not change the relative ordering of
  5.  * the code.
  6.  * 
  7.  * You can remove this comment block or replace it with another.
  8.  * 
  9.  * @see        
  10.  * @version    
  11.  * @author    
  12.  */
  13.  
  14.  
  15. import com.supercede.forms.*;
  16. import java.util.*;
  17. import java.net.*;
  18. import java.io.*;
  19. import java.beans.*;
  20. import java.awt.event.*;
  21. import java.awt.*;
  22.  
  23. public class Form1 extends SuperCedeFrame implements Serializable
  24. {
  25.  
  26.     public Form1() throws IOException, ClassNotFoundException, ClassCastException, SuperCedeInvalidStateException
  27.     {
  28.         SuperCedeConstructor();        // Do not remove this line.
  29.     }
  30.  
  31.     public static void main(String args[])
  32.     {
  33.         // You can add code anywhere in this method.
  34.  
  35.         try
  36.         {
  37.             Form1 app = new Form1();
  38.             app.setVisible(true);
  39.         }
  40.         catch(Throwable t)
  41.         {
  42.             System.out.println("Cannot construct the form: " + t);
  43.             System.exit(1);
  44.         }
  45.     }
  46.  
  47.     public void form1WindowClosing(WindowEvent e)
  48.     {
  49.         // You can add code anywhere in this method.
  50.  
  51.         dispose();
  52.     }
  53.  
  54.     public void form1WindowClosed(WindowEvent e)
  55.     {
  56.         // You can add code anywhere in this method.
  57.  
  58.         SuperCedeWindowClosed();
  59.     }
  60.  
  61.     // SuperCede Begin 2.0 Form Members
  62.     // Do not remove the Begin and End markers.
  63.     // The editor will rewrite the contents of this section each time the form is saved.
  64.  
  65.     private final void SuperCedeConstructor() throws IOException, ClassNotFoundException, ClassCastException, SuperCedeInvalidStateException
  66.     {
  67.         // Construct the actual connectors to give to our base class.
  68.  
  69.         Vector connectors = new Vector(2);
  70.         connectors.addElement(new Form1WindowClosingConnector0());
  71.         connectors.addElement(new Form1WindowClosedConnector1());
  72.  
  73.         super.initializeThis(connectors);
  74.     }
  75.  
  76.     private final void SuperCedeWindowClosed()
  77.     {
  78.         System.exit(0);
  79.     }
  80.  
  81.     // SuperCede End 2.0 Form Members
  82. }
  83.  
  84. // SuperCede Begin 2.0 Form Connectors
  85. // Do not remove the Begin and End markers.
  86. // The editor will rewrite the contents of this section each time the form is saved.
  87.  
  88. // Connections for this Form:
  89. //    Form1WindowClosingConnector0: from Form1.windowClosing to Form1.form1WindowClosing
  90. //    Form1WindowClosedConnector1: from Form1.windowClosed to Form1.form1WindowClosed
  91.  
  92. final class Form1WindowClosingConnector0 extends WindowAdapter implements SuperCedeConnector
  93. {
  94.     private Form1 windowClosingTarget;
  95.  
  96.     public void setWindowClosingTarget(Form1 target)
  97.     {
  98.         windowClosingTarget = target;
  99.     }
  100.  
  101.     public void windowClosing(WindowEvent arg0)
  102.     {
  103.         windowClosingTarget.form1WindowClosing(arg0);
  104.     }
  105.  
  106.     public void setTarget(Object target)
  107.     {
  108.         setWindowClosingTarget((Form1) target);
  109.     }
  110. }
  111.  
  112. final class Form1WindowClosedConnector1 extends WindowAdapter implements SuperCedeConnector
  113. {
  114.     private Form1 windowClosedTarget;
  115.  
  116.     public void setWindowClosedTarget(Form1 target)
  117.     {
  118.         windowClosedTarget = target;
  119.     }
  120.  
  121.     public void windowClosed(WindowEvent arg0)
  122.     {
  123.         windowClosedTarget.form1WindowClosed(arg0);
  124.     }
  125.  
  126.     public void setTarget(Object target)
  127.     {
  128.         setWindowClosedTarget((Form1) target);
  129.     }
  130. }
  131.  
  132. // The following line must be the last line in the file.
  133. // SuperCede End 2.0 Form Connectors
  134.